package com.qclix.inv.xml;

import java.io.Serializable;
import java.util.*;

/**
 * Represents a timesheet with attributes that are displayed with it
 * as client and project name, and the name of the person at the client who
 * will sign it.
 */
public class XMLTimesheet implements Cloneable, Serializable {
    private static final long serialVersionUID = 1L;

    private long id;
    private String clientName;
    private String projectName;
    private String consultant;
    private String responsiblePerson;
    private Collection<XMLWeekDay> days;

    public XMLTimesheet() {
        this.days = new ArrayList<XMLWeekDay>();
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getClientName() {
        return clientName;
    }

    public void setClientName(String clientName) {
        this.clientName = clientName;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public String getConsultant() {
        return consultant;
    }

    public void setConsultant(String consultant) {
        this.consultant = consultant;
    }


    public String getResponsiblePerson() {
        return responsiblePerson;
    }

    public void setResponsiblePerson(String responsiblePerson) {
        this.responsiblePerson = responsiblePerson;
    }

    public Collection<XMLWeekDay> getDays() {
        return days;
    }

    public void setDays(Collection<XMLWeekDay> days) {
        this.days = new TreeSet<XMLWeekDay>(days);
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        XMLTimesheet clone = new XMLTimesheet();
        clone.setId(id);
        clone.setClientName(clientName);
        clone.setProjectName(projectName);
        clone.setConsultant(consultant);
        clone.setResponsiblePerson(responsiblePerson);
        clone.setDays(new TreeSet<XMLWeekDay>());
        for (XMLWeekDay day: days) {
            clone.getDays().add((XMLWeekDay) day.clone());
        }
        return clone;
    }
}
